from django.conf.urls import url
from django.contrib import admin
from . import views

urlpatterns = [
    url('^register/$', views.UserRegisterView.as_view()),
    # '/usernames/' + this.username + '/count/'; 验证用户名是否存在
    url('^usernames/(?P<username>.+)/count/$', views.CheckUserNameView.as_view()),
    # var url = this.host + '/mobiles/' + this.mobile + '/count/'; 请求验证手机号码是否存在
    url('^mobiles/(?P<phone>1[3-9]\d{9})/count/$', views.CheckPhoneNubView.as_view()),
    url('^login/$', views.UserLoginView.as_view()),
    # 用户个人中心
    url('^info/$', views.UserCenterInfoView.as_view()),
    # 个人邮箱
    url('^emails/$', views.EmailView.as_view()),
    # 收货地址
    url('^addresses/$', views.AddressView.as_view()),
    # 新增收货地址
    url('^addresses/create/$', views.CreateAddressView.as_view()),
    # 修改收货地址
    url('^addresses/(?P<area_id>\d+)/$', views.AddressUpdateView.as_view()),
    # 设为默认地址
    url('^addresses/(?P<area_id>\d+)/default/$', views.SetDefaultAddressView.as_view()),
    # 更改title
    url('^addresses/(?P<area_id>\d+)/title/$', views.SetAddressTitleView.as_view()),
    # 修改密码
    url('^password/$', views.ModifyPasswordView.as_view()),
    # 找回密码
    url('^find_password/$', views.FindPasswordView.as_view()),
    # 找回密码第一步
    url('^accounts/(?P<username>[a-zA-Z0-9_-]{5,20})/sms/token/$', views.FindPWDFirstView.as_view()),
    # 找回密码第二步验证码发送在verify.url
    # 验证短信验证码
    url('accounts/(?P<username>[a-zA-Z0-9_-]{5,20})/password/token/$', views.FindPWDSecondView.as_view()),
    # 找回密码第三步 '/users/'+ this.user_id +'/password/
    url('^users/(?P<user_id>\d+)/password/$',views.FindPWDThreeView.as_view())
]
